<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
<?php
include_once 'MailReceiver.php';


$server="pop.163.com";			//pop服务器
$port=110;						//pop端口
$username="******@163.com";		//邮箱用户名
$password="******";				//邮箱密码
$attachfold="d:/t/";			//附件存放地址
$last_mail_num=95;				//最后收取的邮件号



//初始化
$p = new MailReceiver($server,$username,$password,$port);
if(!$p->open()) die($p->getError());

//获取最新邮件个数
$new_mail_count = $p->getNew_mail_count($last_mail_num);
if($new_mail_count<0) die($p->getError());
echo "共有".$p->getNew_mail_count($last_mail_num)."封信件<br/>"; 	

//获取邮件属性列表
$mail_list = $p->getLatest_mail_list($last_mail_num);
if($mail_list==-1) die($p->getError());

//获取内容
foreach($mail_list as $ml){
	echo "<h2>".$ml[num]."(".$ml[size]."B)</h2>";

	$mail = new Mail();
	
	$mail = $p->getMail_by_num($ml[num],$attachfold);
	if(empty($mail)){
		die($p->getError());
	}
	echo "<p>编号：".$mail->__getNum()."</p>";
	echo "<p>大小：".$mail->__getSize()."</p>";
	echo "<p>标题：".$mail->__getSubject()."</p>";
	echo "<p>发件人：".$mail->__getFrom()."</p>";
	echo "<p>发件人姓名：".$mail->__getFrom_name()."</p>";
	echo "<p>收件人：".$mail->__getTo()."</p>";
	echo "<p>收件人姓名：".$mail->__getTo_name()."</p>";
	echo "<p>copy：".$mail->__getCc()."</p>";
	echo "<p>时间：".$mail->__getDate()."</p>";
	echo "<p>内容：".$mail->__getContent()."</p>";
	echo "<p>附件：".print_r($mail->__getAttachment())."</p>";
	
	echo "<hr/>";
	
}


//关闭
$p->close();

?>
</body>
</html>